package com.gp.controller;

import com.gp.entity.MaintainRecord;
import com.gp.entity.TbCar;
import com.gp.util.CommonResult;
import com.gp.vo.CarVo;
import com.gp.vo.TbCarVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("rent/car")
public class CarController {

    @Autowired
    private com.gp.service.CarService carService;

    @PostMapping("findAll")
    public CommonResult finAllCar(Integer page, Integer limit, @RequestBody TbCarVo find){
        return carService.findAllCar(page,limit,find);
    }


    @DeleteMapping("delCarById")
    private CommonResult delCarById(Integer id){
        return carService.delCarById(id);
    }

    @PostMapping("/caralldetails")
    private CommonResult carAllDetails(){
        return carService.carDetails();
    }

    @PostMapping("/insert")
    private CommonResult insert(@RequestBody CarVo carVo){
        return carService.insert(carVo);
    }

    @PutMapping("update")
    private CommonResult update(@RequestBody TbCar tbCar){
        return carService.update(tbCar);
    }

    @PostMapping("insertwei")
    private CommonResult insertwei(@RequestBody MaintainRecord maintainRecord){
        return carService.insertwei(maintainRecord);
    }



}
